package com.project.controller;

import io.swagger.annotations.Api;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@Api(tags="日期时间转换类")
public class TimeFormat {
    public static Date TimeFormat(String time){
        time= time.replace("Z"," UTC");
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
        SimpleDateFormat defaultFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date dt = null;
        try {
            dt = format.parse(time);
//        String result = defaultFormat.format(dt1);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return dt;
    }
}
